 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using Application.Testing.XmlRepository.Helpers;

namespace AnimalsSerialization
{
    [DataContract, KnownType (typeof (Cheetah)), KnownType (typeof (Panther)), KnownType (typeof (Tiger)), 
                   KnownType (typeof (CaymanCrocodile)), KnownType (typeof (KingCobra)), KnownType (typeof (Alligator))]
    abstract public class Animals : IStorageEntity
    {
        private string mName;        
        private int mHealth;        
        private int mDamageInflicted;

        [DataMember]
        public string Name
        {
            get
            {
                return mName;
            }
            set
            {
                if (mName != null)
                {
                    mName = value;
                }
            }
        }

        [DataMember] 
        public int Health
        {
            get
            {
                return mHealth;
            }
            set
            {
                if (mHealth > 0)
                {
                    mHealth = value;
                }
            }
        }

        [DataMember]
        public int DamageInflicted
        {
            get
            {
                return mDamageInflicted;
            }
            set
            {
                if (mDamageInflicted > 0)
                {
                    mDamageInflicted = value;
                }
            }
        }
        abstract public int GetOlder ();
                     
    }
}
